package com.chenmual.netty.l_15_handler3;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;

public class MyServer{
		public static void main(String[] args) throws InterruptedException {
			EventLoopGroup bossGroup = new NioEventLoopGroup(1);
			EventLoopGroup workerGroup = new NioEventLoopGroup();

			try {
				ServerBootstrap serverBootstrap = new ServerBootstrap();
				serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
						.childHandler(new MyServerInitializer15());

				ChannelFuture channelFuture = serverBootstrap.bind(8167).sync();
				channelFuture.channel().closeFuture().sync();
			}finally {
				bossGroup.shutdownGracefully();
				workerGroup.shutdownGracefully();
			}
		}
}
